﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CourseArraging.UControl;
using System.ComponentModel;
using System.Windows.Forms; 
using System.Drawing;
using Stone.DataContracts;

namespace CourseArraging.Frm.jygl
{
    /// <summary>
    /// 版权所有
    /// 石世特@温州医学院 sst330381@gmail.com
    /// </summary> 
    public class FrmTecItem : FrmControlBase
    {
        // Fields
        private IContainer components;
        string tec_jyno;
        string tec_time;

        // Methods
        public FrmTecItem(string tmpno, string time)
        {
            this.components = null;
            this.InitializeComponent();
            this.tec_jyno = tmpno;
            this.tec_time = time;
            ShowData(tmpno, time);
        }

        #region 自动生成

        private void InitializeComponent()
        {
            base.SuspendLayout();
            base.AutoScaleDimensions = new SizeF(6f, 12f);
            //            base.AutoScaleMode = AutoScaleMode.Font;
            base.ClientSize = new Size(0x2b6, 0x103);
            base.Name = "FrmTecItem";
            base.ResumeLayout(false);
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        #endregion

        #region 实现抽象方法

        public override object GetEntity(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0)
            {
                return null;
            }
            DataGridView view = (DataGridView)sender;
            TecEntity entity = new TecEntity();
            entity.user_id = int.Parse(view.Rows[e.RowIndex].Cells["教员流水"].Value.ToString());
            entity.user_no = view.Rows[e.RowIndex].Cells["教员编号"].Value.ToString();
            entity.user_name = view.Rows[e.RowIndex].Cells["姓名"].Value.ToString();
            entity.user_course = view.Rows[e.RowIndex].Cells["可教课程"].Value.ToString();
            entity.user_gddh = view.Rows[e.RowIndex].Cells["固定电话"].Value.ToString();
            entity.user_phone = view.Rows[e.RowIndex].Cells["手机号码"].Value.ToString();
            entity.user_grade = view.Rows[e.RowIndex].Cells["可教年级"].Value.ToString();
            entity.user_depname = view.Rows[e.RowIndex].Cells["分校"].Value.ToString();
            entity.user_address = view.Rows[e.RowIndex].Cells["家庭地址"].Value.ToString();
            return entity;
        }

        public override void ShowData(string tmpno, string time)
        {
            base.dataGridView1.DataSource = base.yhxxdao.GetTecinfo8no_time(tmpno, time);
            if (base.dataGridView1.DataSource == null) return;
            base.dataGridView1.Columns["教员流水"].Visible = false;
        }

        public override void tsb_search_fun()
        {
            FrmTecCondi2 frm = FrmTecCondi2.GetInstance(this.tec_time);
            frm.SearchResultEvent += new FrmTecCondi2.SearchResultEventHandler(frm_SearchResultEvent);
            frm.ShowDialog();
        }



        #endregion

        #region 方法
        void frm_SearchResultEvent(System.Data.DataTable dt)
        {
            base.dataGridView1.DataSource = dt;
            if (base.dataGridView1.DataSource == null) return;
            base.dataGridView1.Columns["教员流水"].Visible = false;
        }
        #endregion
    }



}
